#!/bin/sh
#
#  Migrate Repository To Target 
#
###################
. /etc/profile
. ~/.bash_profile
##################


echo #--------------------------------- Start At $(date +"%Y/%m/%d %T") --------------------------------#

devphost=172.31.2.32
devpusername=siebel
devpsiebelroot=/app/siebel
siebelRoot=/siebel/app/siebel
siebelusername=SADMIN
siebelpassword=SADMIN2
siebeldns=SBA_81_DSN
currentDate=$(date +%Y%m%d)


# Load Env Var
cd $siebelRoot
. $siebelRoot/siebsrvr/siebenv.sh

# Backup customer.dat file
#if [ ! -s "../dbsrvr/oracle/customer_${currentDate}.dat" ]
#then
#        cp ../dbsrvr/oracle/customer.dat  ../dbsrvr/oracle/customer_${currentDate}.dat
#        echo "#----- Backup customer.dat -------#"

#fi

# Download New customer.dat

sftp ${devpusername}@${devphost}:${devpsiebelroot}/dbsrvr/oracle/customer.dat ../dbsrvr/oracle/customer.dat

echo Download  New customer.dat .....



# Execute Migrate Process
echo Execute Migrate Process....

cd $siebelRoot/bin
${siebelRoot}/siebsrvr/bin/repimexp /a I /g ALL /u ${siebelusername} /p ${siebelpassword} /c ${siebeldns} /d SIEBEL /r "SS Temp Siebel Repository" /f ${siebelRoot}/dbsrvr/oracle/customer.dat /l ${siebelRoot}/siebsrvr/log/dev2prod/output/imprep.log /M y

#srvrupgwiz /m master_dev2prod.ucf


